package biz

import (
	"context"
	"github.com/go-kratos/kratos/v2/log"
	"gorm.io/gorm"
	"phm/models/generator/model"
)

type ScMajorRepo interface {
	CreateScMajor(ctx context.Context, uModel *model.ScMajor, db *gorm.DB) error
	UpdateScMajor(ctx context.Context, uModel *model.ScMajor, db *gorm.DB) error
	DeleteScMajorByIds(ctx context.Context, ids []string, db *gorm.DB) error
	GetScMajorById(ctx context.Context, id string) (*model.ScMajor, error)
	GetScMajorByIds(ctx context.Context, ids []string) ([]*model.ScMajor, error)
	GetScMajorList(ctx context.Context, query string, pageNum, pageSize int64) ([]*model.ScMajor, int64, error)
	// GetDB 得到db以方便事务处理
	GetDB() *gorm.DB
}

type ScMajorUseCase struct {
	scMajor ScMajorRepo
	log     *log.Helper
}

func NewScMajorUseCase(scMajor ScMajorRepo, logger log.Logger) *ScMajorUseCase {
	return &ScMajorUseCase{
		scMajor: scMajor,
		log:     log.NewHelper(logger),
	}
}
